/*
 * core.c
 *
 *  Created on: Nov 20, 2010
 *      Author: Orlando Arias
 *     License: GPL v3
 *
 *    hd44780_test
 *    Copyright (C) 2010  Orlando Arias
 *
 *    This program is free software: you can redistribute it and/or modify
 *    it under the terms of the GNU General Public License as published by
 *    the Free Software Foundation, either version 3 of the License, or
 *    (at your option) any later version.
 *
 *    This program is distributed in the hope that it will be useful,
 *    but WITHOUT ANY WARRANTY; without even the implied warranty of
 *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *    GNU General Public License for more details.
 *
 *    You should have received a copy of the GNU General Public License
 *    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

//#define _str_port B
//#define _str_bit 4

#include <inttypes.h>
#include <stdio.h>
#include <util/delay.h>

#include <hd44780.h>

FILE lcd_stream = lcd_createStream();

void main() __attribute__((noreturn));

void main(){
	lcd_init();
	stdout = &lcd_stream;
	uint8_t c = 0;
	while(1){
		for(uint8_t i = '0'; i <= 'z'; i++){
			printf("%c", i);
			_delay_ms(100);
			c++;
			if (!(c%16))
				lcd_sendCommand(SET_DDRAM | 0x40);
			if (!(c%32))
				lcd_sendCommand(SET_DDRAM | 0x00);
		}
	}
	while(1);
}
